package action.OrderAction;

import java.sql.Connection;
import java.util.List;

import model.dao.MessageDao;

import Tools.DbConnection;

import com.opensymphony.xwork2.ActionSupport;
import domain.TransportInfo;
public class ShowOrders extends ActionSupport {
	private List<TransportInfo> messages;
	private int total;
	private int start;
	private int limit;
	public List<TransportInfo> getMessages() {
		return messages;
	}
	public void setMessages(List<TransportInfo> messages) {
		this.messages = messages;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}
	public int getStart() {
		return start;
	}
	public void setStart(int start) {
		this.start = start;
	}
	public int getLimit() {
		return limit;
	}
	public void setLimit(int limit) {
		this.limit = limit;
	}
	@Override
	public String execute() throws Exception {
		DbConnection db=new DbConnection();
		Connection cn=db.init();
		MessageDao dao=new MessageDao();
		total=dao.searchMessageCount(cn);
		messages=dao.searchMessages(cn, start, limit);
		return SUCCESS;
	}

}
